package com.baitai.web.controller.system;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baitai.common.core.domain.AjaxResult;
import com.baitai.system.service.IProductInfoService;
import com.baitai.system.service.IProductOrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/system/pay")
public class PayController {

    @Autowired
    private IProductOrdersService productOrdersService;

    @PostMapping("/aliPayCallback")
    public AjaxResult aliPayCallback( @RequestParam Map request)
    {
        System.out.println(JSON.toJSONString(request));
        productOrdersService.updateProductOrdersStatus(JSONObject.parseObject(JSON.toJSONString(request)));
        return AjaxResult.success();
    }
}
